import { MESSAGE_TYPE } from '@/enum/message';
import { Column, Entity, PrimaryGeneratedColumn } from 'typeorm';
import { BaseEntity } from './base.entity';

/**
 * 消息表
 */
@Entity('message')
export class Message extends BaseEntity {
  @PrimaryGeneratedColumn({
    type: 'int',
    name: 'id',
    comment: '主键，自增',
  })
  id: number;

  @Column({
    type: 'text',
    name: 'content',
    comment: `消息内容`,
  })
  content: string;

  @Column({
    type: 'int',
    name: 'type',
    comment: `
      内容类型
      1聊天消息
      2系统消息
    `,
  })
  type: MESSAGE_TYPE;

  @Column({
    type: 'int',
    name: 'send_user_id',
    comment: `发送人id`,
  })
  sendUserId: string;

  @Column({
    type: 'int',
    name: 'recevie_user_id',
    comment: `接收人id`,
  })
  recevieUserId: number;
}
